package com.sync.syncmasterdata.product.repository.oa;

import com.sync.syncmasterdata.product.entity.oa.ProductWorkflowEntity;
import com.sync.syncmasterdata.product.entity.oa.ProductWorkflowUpdateEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface InventoryWorkflowRepository extends JpaRepository<ProductWorkflowEntity,String> {

    @Query(nativeQuery = true, value= " select main.requestid,main.biangenglx,dt1.*,item.selectname as kuweiwb from formtable_main_322 main inner join formtable_main_322_dt1 dt1 on dt1.mainid=main.id inner join workflow_SelectItem item on FIELDID=24490 and dt1.kuwei=selectvalue  where main.REQUESTID=:requestid")
    List<ProductWorkflowEntity> getProductWorkFlowEntitys(@Param(value = "requestid") String requestid);

    /**
     * 手动选择流程某一条明细的产品推送
     * @param requestid
     * @param huohao
     * @return
     */
    @Query(nativeQuery = true, value= " select main.requestid,main.biangenglx,dt1.*,item.selectname as kuweiwb from formtable_main_322 main inner join formtable_main_322_dt1 dt1 on dt1.mainid=main.id inner join workflow_SelectItem item on FIELDID=24490 and dt1.kuwei=selectvalue  where main.REQUESTID=:requestid and huohao=:huohao")
    List<ProductWorkflowEntity> getProductWorkFlowEntitysByhuohao(@Param(value = "requestid") String requestid,@Param(value = "huohao") String huohao);
}
